package com.eling.elcms.community.model;

import com.eling.elcms.basedoc.model.EnumSerializer;
import com.eling.elcms.core.dao.hibernate.search.EnumBridge;
import com.eling.elcms.core.model.BaseModel;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.hibernate.search.annotations.DocumentId;
import org.hibernate.search.annotations.FieldBridge;
import org.hibernate.search.annotations.Indexed;

import javax.persistence.*;
/**
 * 税务登记
 * @author Wen
 *
 */
@Entity
@Indexed
@Table(name = "cm_taxregister")
public class TaxRegister extends BaseModel {
    
    /**
	 * 
	 */
	private static final long serialVersionUID = 4995284072826226673L;

	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@DocumentId
	private Long pkTaxRegister;
    
    /** 纳税人识别号 */
    @Column
	private String taxPayerNumber;
	
	/** 纳税类型税码 */
    @Column
	private String taxPayerCode;
    
    /** 税务登记电子版 */
    @Column
	private String taxRegisterUrl;
    
    /** 一般纳税人资格证 */
    @Column
	private String generalTaxpayerUrl;
	
	/** 纳税人类型 */
	@Enumerated(EnumType.STRING)
	@FieldBridge(impl = EnumBridge.class)
	private TaxPayerType taxPayerType;
    
    @Version
	private Integer version;

    @JsonSerialize(using = EnumSerializer.class)
	public static enum TaxPayerType {
		Small("小规模纳税人"),
		Common("一般纳税人");
		
		private String display;
		TaxPayerType(String display) {
			this.display = display;
		}
		public String getDisplay() {
			return display;
		}
	}

	public Long getPkTaxRegister() {
		return pkTaxRegister;
	}

	public void setPkTaxRegister(Long pkTaxRegister) {
		this.pkTaxRegister = pkTaxRegister;
	}

	public String getTaxPayerNumber() {
		return taxPayerNumber;
	}

	public void setTaxPayerNumber(String taxPayerNumber) {
		this.taxPayerNumber = taxPayerNumber;
	}

	public String getTaxPayerCode() {
		return taxPayerCode;
	}

	public void setTaxPayerCode(String taxPayerCode) {
		this.taxPayerCode = taxPayerCode;
	}


	public String getTaxRegisterUrl() {
		return taxRegisterUrl;
	}

	public void setTaxRegisterUrl(String taxRegisterUrl) {
		this.taxRegisterUrl = taxRegisterUrl;
	}

	public String getGeneralTaxpayerUrl() {
		return generalTaxpayerUrl;
	}

	public void setGeneralTaxpayerUrl(String generalTaxpayerUrl) {
		this.generalTaxpayerUrl = generalTaxpayerUrl;
	}

	public TaxPayerType getTaxPayerType() {
		return taxPayerType;
	}

	public void setTaxPayerType(TaxPayerType taxPayerType) {
		this.taxPayerType = taxPayerType;
	}

	public Integer getVersion() {
		return version;
	}

	public void setVersion(Integer version) {
		this.version = version;
	}
}
